package com.ruoyi.system.telManage.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.telManage.domain.TelManageHistory;
import com.ruoyi.system.telManage.service.ITelManageHistoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 手机操作记录Controller
 *
 * @author ruoyi
 * @date 2024-12-02
 */
@RestController
@RequestMapping("/history/tel")
public class TelManageHistoryController extends BaseController {
    @Autowired
    private ITelManageHistoryService telManageHistoryService;

    /**
     * 查询手机操作记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TelManageHistory telManageHistory) {
        startPage();
        List<TelManageHistory> list = telManageHistoryService.selectTelManageHistoryList(telManageHistory);
        return getDataTable(list);
    }

    /**
     * 导出手机操作记录列表
     */
    @GetMapping("/export")
    public AjaxResult export(TelManageHistory telManageHistory) {
        List<TelManageHistory> list = telManageHistoryService.selectTelManageHistoryList(telManageHistory);
        ExcelUtil<TelManageHistory> util = new ExcelUtil<TelManageHistory>(TelManageHistory.class);
        return util.exportExcel(list, "手机操作记录数据");
    }

    /**
     * 获取手机操作记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(telManageHistoryService.selectTelManageHistoryById(id));
    }

    /**
     * 新增手机操作记录
     */
    @PostMapping
    public AjaxResult add(@RequestBody TelManageHistory telManageHistory) {
        return toAjax(telManageHistoryService.insertTelManageHistory(telManageHistory));
    }

    /**
     * 修改手机操作记录
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TelManageHistory telManageHistory) {
        return toAjax(telManageHistoryService.updateTelManageHistory(telManageHistory));
    }

    /**
     * 删除手机操作记录
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(telManageHistoryService.deleteTelManageHistoryByIds(ids));
    }
}
